home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 22 / CU Amiga Magazine's Super CD-ROM 22 (1998)(EMAP Images)(GB)[!][issue 1998-05].iso / PowerPC / Programming / PPCSmallEiffel / lib_se / e_require.e < prev    next >
Encoding:
Text File  |  1998-01-16  |  3.3 KB  |  109 lines

  1. --          This file is part of SmallEiffel The GNU Eiffel Compiler.
  2. --          Copyright (C) 1994-98 LORIA - UHP - CRIN - INRIA - FRANCE
  3. --            Dominique COLNET and Suzanne COLLIN - colnet@loria.fr 
  4. --                       http://www.loria.fr/SmallEiffel
  5. -- SmallEiffel is  free  software;  you can  redistribute it and/or modify it 
  6. -- under the terms of the GNU General Public License as published by the Free
  7. -- Software  Foundation;  either  version  2, or (at your option)  any  later 
  8. -- version. SmallEiffel is distributed in the hope that it will be useful,but
  9. -- WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  10. -- or  FITNESS FOR A PARTICULAR PURPOSE.   See the GNU General Public License 
  11. -- for  more  details.  You  should  have  received a copy of the GNU General 
  12. -- Public  License  along  with  SmallEiffel;  see the file COPYING.  If not,
  13. -- write to the  Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  14. -- Boston, MA 02111-1307, USA.
  15. --
  16. class E_REQUIRE
  17. --
  18. -- To store a `require' clause.
  19. --
  20.    
  21. inherit ASSERTION_LIST;
  22.          
  23. creation make, from_runnable
  24.  
  25. feature 
  26.    
  27.    is_require_else: BOOLEAN;
  28.             
  29.    set_require_else is
  30.       do
  31.      is_require_else := true;
  32.       end;
  33.       
  34.    name: STRING is
  35.       do
  36.      if is_require_else then
  37.         Result := "require else";
  38.      else
  39.         Result := "require";
  40.      end;
  41.       end;
  42.    
  43.    short(h1,r1: STRING) is
  44.       local
  45.      i: INTEGER;
  46.       do
  47.      short_print.hook_or(h1,r1);
  48.      if header_comment = Void then
  49.         short_print.hook_or("hook412","");
  50.      else
  51.         short_print.hook_or("hook413","");
  52.         header_comment.short("hook414","         -- ","hook415","%N");
  53.         short_print.hook_or("hook416","");
  54.      end;
  55.      if list = Void then
  56.         short_print.hook_or("hook417","");
  57.      else
  58.         short_print.hook_or("hook418","");
  59.         from  
  60.            i := 1;
  61.         until
  62.            i = list.upper          
  63.         loop
  64.            list.item(i).short("hook419","         ", -- before each assertion
  65.                   "hook420","", -- no tag
  66.                   "hook421","", -- before tag
  67.                   "hook422",": ", -- after tag
  68.                   "hook423","", -- no expression
  69.                   "hook424","", -- before expression
  70.                   "hook425",";", -- after expression except last
  71.                   "hook426","%N", -- no comment
  72.                   "hook427","", -- before comment
  73.                   "hook428"," -- ", -- comment begin line
  74.                   "hook429","%N", -- comment end of line
  75.                   "hook430","", -- after comment
  76.                   "hook431",""); -- end of each assertion
  77.  
  78.            i := i + 1;
  79.         end;
  80.         list.item(i).short("hook419","         ", -- before each assertion
  81.                    "hook420","", -- no tag
  82.                    "hook421","", -- before tag
  83.                    "hook422",": ", -- after tag
  84.                    "hook423","", -- no expression
  85.                    "hook424","", -- before expression
  86.                    "hook432","", -- after expression except last
  87.                    "hook426","%N", -- no comment
  88.                    "hook427","", -- before comment
  89.                    "hook428"," -- ", -- comment begin line
  90.                    "hook429","%N", -- comment end of line
  91.                    "hook430","", -- after comment
  92.                    "hook431","");
  93.         short_print.hook_or("hook433","");
  94.      end;
  95.      short_print.hook_or("hook434","");
  96.       ensure
  97.      fmt.indent_level = old fmt.indent_level;
  98.       end;
  99.  
  100. feature {NONE}
  101.    
  102.    check_assertion_mode: STRING is
  103.       do
  104.      Result := "req";
  105.       end;
  106.       
  107. end -- E_REQUIRE
  108.  
  109.